class AppleHandler extends FruitHandler {
    @Override
    protected Fruit createFruit(String kind) {
        if ("A".equals(kind)) {
            return new Apple();
        }
        return null;
    }
}

class BananaHandler extends FruitHandler {
    @Override
    protected Fruit createFruit(String kind) {
        if ("B".equals(kind)) {
            return new Banana();
        }
        return null;
    }
}
